Skip to content

Conversation

@traversaro
Copy link
Contributor

Thanks a lot for all the work on this project!

In RoboStack/ros-humble#275 we tried to build it in robostack, but we experienced some linking errors, that were created by the setting of the -Wl,--no-undefined linking option applied to Python extensions.

In some cases, Python extensions are intentionally not linked to the libpython shared library (as for example when linking to the Python::Module imported library, see https://gitlab.kitware.com/cmake/cmake/-/blob/v4.0.0/Modules/FindPython/Support.cmake?ref_type=tags#L4206), mostly to ensure support for Python interpreters that statically link the libpython library (see astral-sh/python-build-standalone#540). So, in general setting -Wl,--no-undefined for Python extensions can lead to linkin errors.

To avoid this problem, this PR uses target_link_options in place of link_options to only set spatio_temporal_voxel_layer_core for the spatio_temporal_voxel_layer_core. The script falls back to use link_options if using a version of CMake <= 3.13 .

If the minimum version of CMake required by the project can be raised to 3.16 (that was the minimum version of CMake required by ROS 2 Foxy that reached the EOL in May 2023, see https://www.ros.org/reps/rep-2000.html#foxy-fitzroy-may-2020-may-2023), the code can be simplified to remove the check on CMake ersion.

@SteveMacenski
Copy link
Owner

an update to 3.16 would be perfectly fine!

@traversaro traversaro changed the title Fix build with statically-linked Python interpreter Fix build with statically-linked Python interpreter and bump minimum required version to CMake 3.16 Apr 10, 2025
@traversaro
Copy link
Contributor Author

an update to 3.16 would be perfectly fine!

Thanks! I did that in 07039a3, let me know if you prefer me to squash the commits, change the order (i.e. before bump the cmake minimum required version and then change add_link_options to target_link_options) or anything else, thanks!

@SteveMacenski SteveMacenski merged commit c358263 into SteveMacenski:ros2 Apr 10, 2025
SteveMacenski pushed a commit that referenced this pull request Apr 15, 2025
…required version to CMake 3.16 (#325)

* Fix build with statically-linked Python interpreter

* Bump minimum required version of CMake to 3.16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants